fix(config): gate project-context preservation on codeMieUrl equality#400
Merged
Conversation
2a74d69 to
897e4b4
Compare
codemie-ai
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a cross-environment profile leak in
ConfigLoader. When--profile <global>is used from a repo whose local.codemie/codemie-cli.config.jsondeclares a differentactiveProfilewith a differentcodeMieUrl,ConfigLoaderpreservedcodeMieProject,codeMieIntegration, andcodeMieUrlfrom the local team profile viafilterProjectFields()/PROJECT_FIELDS. The intent ofPROJECT_FIELDS(introduced in c35b54a) is "personal provider on top of team's project context" — a same-env composition. When URLs differ, all three preserved values reference the wrong environment.The loud failure surfaced while validating EPMCDME-13167 (managed-MCP catalog provisioning into Claude Desktop):
proxy connect desktop --profile previewfrom this repo spawned the proxy daemon withtargetUrl=previewbutsyncCodeMieUrl=prod. The catalog fetch hit prod, oauth2-proxy returned a Keycloak HTML login page, andJSON.parsethrew on<!-- Keycl…. Silent paths corrupted by the same leak include SSO credential lookup, skills sync, analytics push, statusline installer, and agent API routing (baseUrlis derived fromcodeMieUrlin `AgentCLI`).Changes
Impact
Before: `--profile ` from a repo with a different local active profile silently routed every `codeMieUrl`-keyed operation (SSO creds, catalog fetch, analytics, agent API) to the local team's environment instead of the selected profile's.
After: cross-env switches honor the selected profile's `codeMieUrl`. Same-env compositions ("personal provider + team's project context") continue to work unchanged. Edge cases handled: missing URL on either side is NOT a conflict (preserves the common case where the local team profile only sets `codeMieProject`).
Unblocks EPMCDME-13167 manual verification — `codemie proxy connect desktop --profile preview` from this repo now stamps all 18 entries (7 bundled defaults + 11 EPAM) into Claude Desktop's managed-MCP config. Verified live post-build.
Checklist
Ticket
None at PR creation time — `codemie-jira-assistant` was unresponsive after 5 retries (3 min). Per `.ai-run/guides/standards/git-workflow.md`, type-scoped branches (`fix/`) are allowed without a ticket prefix. A bug ticket will be filed under epic EPMCDME-4878 (MCP integration) as a sibling to EPMCDME-13167 once Jira is reachable, then linked here.